home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / DELPHI / WINSHOES.ZIP / NNTPR.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-03-20  |  1.4 KB  |  65 lines

  1. unit Nntpr;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Winshoes;
  8.  
  9. type
  10.   TformNNTP_R = class(TForm)
  11.     Label1: TLabel;
  12.     editHost: TEdit;
  13.     butnRetrieve: TButton;
  14.     memoMessage: TMemo;
  15.     nntp: TPBE_sNNTP;
  16.     Label2: TLabel;
  17.     editNG: TEdit;
  18.     lablStatus: TLabel;
  19.     procedure butnRetrieveClick(Sender: TObject);
  20.     procedure nntpStatus(const sMessage: String);
  21.   private
  22.   public
  23.   end;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure TformNNTP_R.butnRetrieveClick(Sender: TObject);
  30. var
  31.     strm: TFilestream;
  32. begin
  33.     try
  34.     with nntp do begin
  35.       Host := editHost.Text;
  36.       Connect;
  37.       butnRetrieve.Caption := '..Busy..';
  38.       try
  39.           ModeReader; {This is not needed per RFC, but there are a few improperly configured servuers out there}
  40.           SelectGroup(editNG.Text);
  41.         strm := TFilestream.Create('c:\tempwins.txt', fmCreate);
  42.         with strm do
  43.           try
  44.             GetMessage(MsgLo, strm, strm);
  45.           finally
  46.             free;
  47.           end;
  48.         memoMessage.lines.LoadFromFile('c:\tempwins.txt');
  49.       finally
  50.           Disconnect;
  51.       end;
  52.     end;
  53.   except
  54.       on e: Exception do Application.ShowException(E);
  55.   end;
  56.   butnRetrieve.Caption := '&Retrieve';
  57. end;
  58.  
  59. procedure TformNNTP_R.nntpStatus(const sMessage: String);
  60. begin
  61.     lablStatus.caption := sMessage;
  62. end;
  63.  
  64. end.
  65.